home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 2: Applications / Linux Cubed Series 2 - Applications.iso / utils / file / logiso.000 / logiso / Utils / find_links < prev    next >
Encoding:
Korn shell script  |  1995-03-24  |  797 b   |  38 lines

  1. #! /bin/ksh
  2. USAGE='USAGE: find_links [ ROOT_DIR ]
  3.     Print to stdout lines with FILE_PATH and LINK for every
  4.     link on the hard disk.
  5. '
  6. # (C) Copyright 1995 by Michael Coulter.  All rights reserved.
  7.  
  8. # Process parameters
  9.  
  10.    if [ $# -gt 1 ]
  11.    then
  12.       echo "$USAGE" >&2
  13.       echo "Too many arguments." >&2
  14.       exti 1
  15.    fi
  16.    ROOT_DIR="/"
  17.    if [ $# -gt 0 ]
  18.    then
  19.       ROOT_DIR="$1"; shift
  20.    fi
  21.    if [ ! -d "$ROOT_DIR" ]
  22.    then
  23.       echo "$USAGE" >&2
  24.       echo "$ROOT_DIR is not a directory" >&2
  25.       exti 1
  26.    fi
  27.  
  28. # Do find
  29.  
  30.    find  ${ROOT_DIR}                       \
  31.          -path '/mnt/*' -prune                 \
  32.       -o -path '/cdmnt/*' -prune                  \
  33.       -o -path '/tmp/*' -prune                  \
  34.       -o -path '/proc/*' -prune                \
  35.       -o -path '/var/tmp/*' -prune                \
  36.       -o -path '/var/utmp/*' -prune                \
  37.       -o -type l
  38.